var yearsdata = [];
var address = "";
var list = [];
var rate = [];
var result = {};
var fixedlist = [];
var estatelist = [];
var max = 0;
var url = location.search; //获取url中"?"符后的字串

if (url.indexOf("?") != -1) {
    address = decodeURI(url.substr(1).split("=")[1]);
}

if (address == "杭州") {
    result = {
        "5.5563183E7": 2.4720743E7,
        "2016": 5.8424194E7,
        "2015": 5.5563183E7,
        "2014": 4.952701E7,
        "5.8424194E7": 2.606409E7,
        "2013": 4.2638732E7,
        "2012": 3.7227544E7,
        "3.7227544E7": 1.5973611E7,
        "4.2638732E7": 1.8532841E7,
        "4.952701E7": 2.3010823E7
    };
} else if (address == "宁波") {
    result = {
        "2016": 4961,
        "2015": 4507,
        "2901.0": 884,
        "2014": 3989,
        "2013": 3423,
        "4507.0": 1229,
        "2012": 2901,
        "4961.0": 1270,
        "3989.0": 1328,
        "3423.0": 1123
    };
} else if (address == "绍兴") {
    result = {
        "2.5828403E7": 0,
        "2.3046833E7": 0,
        "2015": 2.5828403E7,
        "2014": 2.3046833E7,
        "2013": 2.0019855E7,
        "2012": 1.7225646E7,
        "2.0019855E7": 0,
        "1.7225646E7": 0
    };

} else if (address == "嘉兴") {
    result = {
        "1.9101518E7": 5108262,
        "2.513818E7": 4584133,
        "2.2212077E7": 5257184,
        "2016": 2.7901555E7,
        "2015": 2.513818E7,
        "2014": 2.2212077E7,
        "2013": 1.9101518E7,
        "2012": 1.6423109E7,
        "2.7901555E7": 4783968,
        "1.6423109E7": 4158763
    };
} else if (address == "金华") {
    result = {
        "1.5947862E7": 0,
        "0.0": 0,
        "2016": 0,
        "2015": 1.8361601E7,
        "2014": 1.5947862E7,
        "2013": 1.3643582E7,
        "2012": 1.1268026E7,
        "1.3643582E7": 0,
        "1.8361601E7": 0,
        "1.1268026E7": 0
    };

} else if (address == "海曙") {
    result = {
        "2016": 4961,
        "2015": 4507,
        "2901.0": 884,
        "2014": 3989,
        "2013": 3423,
        "4507.0": 1229,
        "2012": 2901,
        "4961.0": 1270,
        "3989.0": 1328,
        "3423.0": 1123
    };
} else if (address == "镇海") {
    result = {
        "2016": 4961,
        "2015": 4507,
        "2901.0": 884,
        "2014": 3989,
        "2013": 3423,
        "4507.0": 1229,
        "2012": 2901,
        "4961.0": 1270,
        "3989.0": 1328,
        "3423.0": 1123
    };
} else if (address == "江北") {
    result = {
        "2016": 4961,
        "2015": 4507,
        "2901.0": 884,
        "2014": 3989,
        "2013": 3423,
        "4507.0": 1229,
        "2012": 2901,
        "4961.0": 1270,
        "3989.0": 1328,
        "3423.0": 1123
    };
} else if (address == "北仑") {
    result = {
        "2016": 4961,
        "2015": 4507,
        "2901.0": 884,
        "2014": 3989,
        "2013": 3423,
        "4507.0": 1229,
        "2012": 2901,
        "4961.0": 1270,
        "3989.0": 1328,
        "3423.0": 1123
    };
} else if (address == "鄞州") {
    result = {
        "2016": 4961,
        "2015": 4507,
        "2901.0": 884,
        "2014": 3989,
        "2013": 3423,
        "4507.0": 1229,
        "2012": 2901,
        "4961.0": 1270,
        "3989.0": 1328,
        "3423.0": 1123
    };
} else if (address == "象山") {
    result = {
        "2016": 4961,
        "2015": 4507,
        "2901.0": 884,
        "2014": 3989,
        "2013": 3423,
        "4507.0": 1229,
        "2012": 2901,
        "4961.0": 1270,
        "3989.0": 1328,
        "3423.0": 1123
    };
} else if (address == "奉化") {
    result = {
        "2016": 4961,
        "2015": 4507,
        "2901.0": 884,
        "2014": 3989,
        "2013": 3423,
        "4507.0": 1229,
        "2012": 2901,
        "4961.0": 1270,
        "3989.0": 1328,
        "3423.0": 1123
    };
} else if (address == "慈溪") {
    result = {
        "2016": 4961,
        "2015": 4507,
        "2901.0": 884,
        "2014": 3989,
        "2013": 3423,
        "4507.0": 1229,
        "2012": 2901,
        "4961.0": 1270,
        "3989.0": 1328,
        "3423.0": 1123
    };
} else if (address == "余姚") {
    result = {
        "2016": 4961,
        "2015": 4507,
        "2901.0": 884,
        "2014": 3989,
        "2013": 3423,
        "4507.0": 1229,
        "2012": 2901,
        "4961.0": 1270,
        "3989.0": 1328,
        "3423.0": 1123
    };

} else if (address == "宁海") {
    result = {
        "2016": 4961,
        "2015": 4507,
        "2901.0": 884,
        "2014": 3989,
        "2013": 3423,
        "4507.0": 1229,
        "2012": 2901,
        "4961.0": 1270,
        "3989.0": 1328,
        "3423.0": 1123
    };
}

for (var key in result) {
    if (key == "2013" || key == "2014" || key == "2015" || key == "2016" || key == "2012") {
        if (key != "2012") {
            yearsdata.push(result[key]);
        }
        if (max < result[key]) {
            max = result[key];
        }
        list.push({
            value: result[key],
            name: key
        })
    } else {
        fixedlist.push(key);
        estatelist.push(result[key]);
    }

}
for (var i = list.length - 1; i > 0; i--) {
    //计算比上一年增高的比率
    var r = (list[i].value / list[i - 1].value).toFixed(1) + ' %';
    rate.push({
        value: r,
        name: list[i].name
    })
}